package com.manager.service;

import com.manager.dao.TeacherDao;
import com.manager.domain.Teacher;

public class TeacherService {
    /**
     * 老师管理
     */
    TeacherDao teacherDao = new TeacherDao();
    public boolean addTeacher(Teacher tec) {
       return teacherDao.addTeacher(tec);
    }

    public boolean isExists(String id) {
        int index = teacherDao.isExists(id);
        if (index!=-1){
            return true;
        }
        return false;
    }
    public void delTeacher(String id) {
        teacherDao.delTeacher(id);
    }

    public void upDataTeacher(String id,Teacher newTec) {
        teacherDao.upDataTeacher(id,newTec);
    }

    public Teacher[] findAllTeacher() {
        Teacher[] tec = teacherDao.findAllTeacher();
        for (int i = 0; i < tec.length; i++) {
            Teacher teacher = tec[i];
            if (teacher!=null){
                return tec;
            }
        }
        return null;
    }
}
